home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / SERIALZE.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  89 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.4  $
  6. //
  7. // Definition of TSerializer class
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_SERIALZE_H)
  10. #define OWL_SERIALZE_H
  11.  
  12. #if !defined(OWL_DEFS_H)
  13. # include <owl/defs.h>
  14. #endif
  15. #if !defined(OWL_EVENTHAN_H)
  16. # include <owl/eventhan.h>
  17. #endif
  18.  
  19. #if defined(BI_NAMESPACE)
  20. namespace OWL {
  21. #endif
  22.  
  23. // Generic definitions/compiler options (eg. alignment) preceeding the 
  24. // definition of classes
  25. #include <services/preclass.h>
  26.  
  27. //
  28. // class TSerializer
  29. // ~~~~~ ~~~~~~~~~~~
  30. // This class sends a block of data to another window.
  31. //
  32. class _OWLCLASS TSerializer {
  33.   public:
  34.     // Enum for different types of blocks sent from a window to
  35.     // another. This enum is sent as the wParam.
  36.     //
  37.     enum TBlock {
  38.       End = 0,    // end of data, lParam == 0
  39.       Data1,      // data is stored in bits 0x000000FF of lParam
  40.       Data2,      // data is stored in bits 0x0000FFFF of lParam
  41.       Data3,      // data is stored in bits 0x00FFFFFF of lParam
  42.       Data4,      // data is stored in bits 0xFFFFFFFF of lParam
  43.       Begin,      // beginning of data, lParam length of data
  44.     };
  45.     TSerializer(HWND hwndTarget, uint32 length, void far* data);
  46. };
  47.  
  48. //
  49. // Serializer window targets should catch the following registered message
  50. // to receive the block of data.
  51. //
  52. #define SerializerMessage "SERIALIZERMESSAGE"
  53.  
  54. //
  55. // class TSerializeReceiver
  56. // ~~~~~ ~~~~~~~~~~~~~~~~~~
  57. // Mix-in class that automatically puts together the block of data sent by
  58. // TSerializer.
  59. //
  60. class _OWLCLASS TSerializeReceiver : virtual public TEventHandler {
  61.   public:
  62.     TSerializeReceiver();
  63.  
  64.     // Derived classes should override this function to copy the received data.
  65.     // passed to it.
  66.     //
  67.     virtual void DataReceived(uint32 length, void far* data);
  68.  
  69.   protected:
  70.     int32 BlockReceived(TParam1, TParam2);
  71.  
  72.   private:
  73.     char HUGE* Data;
  74.     char HUGE* CurPtr;
  75.     uint32 Length;
  76.  
  77.   DECLARE_RESPONSE_TABLE(TSerializeReceiver);
  78. };
  79.  
  80. // Generic definitions/compiler options (eg. alignment) following the 
  81. // definition of classes
  82. #include <services/posclass.h>
  83.  
  84. #if defined(BI_NAMESPACE)
  85. } // namespace OWL
  86. #endif
  87.  
  88. #endif  // OWL_SERIALZE_H
  89.